/*
package com.spsy.search.service.impl;

import com.alibaba.fastjson.JSON;
import com.spsy.search.entity.SpsyProject;
import com.spsy.search.repository.SpsyProjectRepositroy;
import com.spsy.search.service.ElasticSearchService;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.util.Map;

*/
/**
 * @author: liuzhiping
 * @date: 2024/11/29 10:25
 **//*

@Service
public class ElasticSearchServiceImpl implements ElasticSearchService {

    @Autowired
    private RestHighLevelClient restHighLevelClient;

    @Autowired
    private ElasticsearchRestTemplate elasticsearchRestTemplate;

    @Autowired
    private SpsyProjectRepositroy spsyProjectRepositroy;



    @Override
    public String add(String indexName, String id, SpsyProject sysyProject) throws Exception {
        //构建es对象数据,es对象有自己的数据封装，规则
        */
/*IndexRequest indexRequest = new IndexRequest(indexName);
        indexRequest.id(id);
        Map map = new ObjectMapper().convertValue(sysyProject, Map.class);
        indexRequest.source(map);

        IndexResponse indexResponse = this.restHighLevelClient.index(indexRequest, RequestOptions.DEFAULT);

        int status = indexResponse.status().getStatus();

        System.out.println("status77:"+status);*//*



       */
/* elasticsearchRestTemplate.save(sysyProject);

        System.out.println("elasticsearch sysyProject:"+ JSON.toJSONString(sysyProject));*//*



        System.out.println("indexName:"+indexName+" id:"+id+" sysyProject:"+JSON.toJSONString(sysyProject));

        //第三步封装
        return this.spsyProjectRepositroy.add(indexName,id,sysyProject);


    }

    @Override
    public String del(String indexName, String id) {
        return this.spsyProjectRepositroy.del(indexName, id);
    }

    @Override
    public SpsyProject getById(String indexName, String id) {

        return this.spsyProjectRepositroy.getById(indexName,id);

    }
}
*/
